package com.example.day06;

import com.sun.javafx.robot.FXRobotImage;

public class ArrayTest {
    public static void main(String[] args) {
        int[] ints;
        ints = new int[10];
        double[] doubles = new double[100];
        String[] strings = {"asdf", "fdsa"};

//        System.out.println(ints[ints.length]);
        System.out.println(strings[0] + strings[1]);
        System.out.println(doubles[0]); // ?
        System.out.println(ints[ints.length - 1]);

        for (int index = 0; index < ints.length; index++) {
            System.out.println(ints[index]);
        }

        for (int i = 0; i < doubles.length; i++) {
            doubles[i] = i;
        }

        // iter + Tab
        for (double aDouble : doubles) {
            System.out.println(aDouble);
        }

        Object[] objects = {1, 1.2, "", new ArrayTest(), ""};

        boolean[][] booleans = new boolean[5][8];
        System.out.println(booleans[booleans.length - 1][booleans[0].length - 1]);

        for (int row = 0; row < booleans.length; row++) {
            for (int col = 0; col < booleans[0].length; col++) {
                if (row >= col) {
                    System.out.print(booleans[row][col] + "\t");
                }
            }
            System.out.println();
        }

        byte[][] bytes = {
                {1},
                {2, 3},
                {4, 5, 6}
        };
        for (int row = 0; row < bytes.length; row++) {
            for (int col = 0; col < bytes[row].length; col++) {
                System.out.print(bytes[row][col] + "\t");
            }
            System.out.println();
        }

        // 输出乘法口诀表

        byte[] power = {1, 2, 3, 4, 5, 6, 7, 8, 9};
        for (int i = 0; i < power.length; i++) {
            for (int j = 0; j < power.length; j++) {
                if (i >= j) {
                    System.out.print(power[i] + " * " + power[j] + " = " + (power[i] * power[j]) + "\t");
                }
            }
            System.out.println();
        }

    }
}